import platform
import psutil
import wmi
import os

def get_system_info():
    print("\n=== 系统信息 ===")
    print(f"操作系统: {platform.system()} {platform.version()}")
    print(f"系统架构: {platform.machine()}")
    
def get_disk_info():
    print("\n=== 硬盘信息 ===")
    c = wmi.WMI()
    
    # 获取物理硬盘信息
    print("\n物理硬盘:")
    for disk in c.Win32_DiskDrive():
        size_gb = float(disk.Size) / (1024**3)
        print(f"\n硬盘型号: {disk.Model}")
        print(f"接口类型: {disk.InterfaceType}")
        print(f"总容量: {size_gb:.2f} GB")
        
    # 获取分区信息
    print("\n分区信息:")
    partitions = psutil.disk_partitions()
    for partition in partitions:
        try:
            usage = psutil.disk_usage(partition.mountpoint)
            print(f"\n驱动器: {partition.device}")
            print(f"文件系统: {partition.fstype}")
            print(f"总容量: {usage.total / (1024**3):.2f} GB")
            print(f"已用空间: {usage.used / (1024**3):.2f} GB")
            print(f"可用空间: {usage.free / (1024**3):.2f} GB")
            print(f"使用率: {usage.percent}%")
        except:
            continue

if __name__ == "__main__":
    get_system_info()
    get_disk_info()